<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        (function() {
            // html fontSizr 
            const eleHtml = document.documentElement;
            // 屏幕宽度
            eleHtml.style.fontSize = window.innerWidth / 10 + 'px';
            window.addEventListener('resize', () =>{
                console.log('resize');
                eleHtml.style.fontSize = window.innerWidth / 10 + 'px';
            })
        })()
    </script>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .col{
            width: 5rem;
            height: 100px;
            line-height: 100px;
            background-color: green;
            color: white;
            font-size: 50px;
        }
    </style>
</head>
<body>
    <div class="col">123</div>
</body>
</html>